<template>
	<view class="check-stock-main-search-component">
		<view class="search-form-box">
			<u-form labelPosition="left" :labelWidth="84" :model="form" ref="form" :labelStyle="{color:'#787878'}">
				<u-form-item label="计划单号：" borderBottom>
					<u-input v-model="form.PlanNo" placeholder="请输入..." border="none" clearable />
				</u-form-item>
				<u-form-item label="计划状态：" borderBottom>
					<u-view-form-select-picker v-model="form.InspectionStatus" :list="selectList.checkPlan" value-field="code" label-field="name" />
				</u-form-item>
			</u-form>
		</view>
		<view class="search-bottom">
			<u-button type="primary" text="查 询" @click="onSearch" />
		</view>
	</view>
</template>

<script>
import UViewFormSelectPicker from '@/components/UViewFormSelectPicker.vue'
import { getDicList, $alert } from '@/static/js/utils/index.js'
const defaultQueryForm = {
	PlanNo:'',
	InspectionStatus:''
}
export default {
	name:'checkStockMainSearchComponent',
	components:{UViewFormSelectPicker},
	emits:['callback'],
	props:{
		resetflag: {
		  type: Number,
		  default: 0
		}
	},
	data(){
		return {
			form:{...defaultQueryForm},
			selectList:{
				checkPlan:[]
			}
		}
	},
	watch:{
		resetflag(newVal, oldVal){
			if (newVal !== oldVal) {
			  this.form = {...defaultQueryForm}
			}
		}
	},
	methods:{
		onSearch(){
			this.$emit('callback',this.form)
		}
	},
	mounted() {
		this.selectList.checkPlan = getDicList(this.$store,'task_status')
	}
}
</script>

<style lang="scss" scoped>
.check-stock-main-search-component{
	height: 100%;
	display: flex;
	flex-direction: column;
	.search-form-box{
		flex-grow: 1;
		background-color: $uni-bg-color;
		overflow: auto;
		padding: 10rpx 20rpx;
	}
	.search-bottom{
		flex-shrink: 0;
		padding: 10rpx 0;
		padding: 20rpx;
	}
}
</style>